package com.softer.chengxin.common.util;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @author Gong Zhiyang
 * @date 2018/10/15
 */
public class GetFileNameUtil {
    private static SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMddHHmmss");
    private static int number;
    private static String starttime;
    static {
        number = 1000;
        starttime = sdf.format(new Date());
    }

    public synchronized static String creatName() {
        String time = sdf.format(new Date());
        if (time.equals(starttime)) {
            number++;
        } else {
            starttime = time;
            number = 1000;
        }
        return time + number;
    }
}
